import { getSocket } from './mysocket'
import iframe from './framePost'
import request from './request'

function binding(name) {
  if (name === 'ws') return getSocket()
  else if (name === 'ax') return request
  else if (name === 'pm') return iframe
}
function access(name) {
  const instance = binding(name)
  instance.dispatch = (action, params = {}) => instance.sending(action, params)
  return instance
}

export default access
